#include <bits/stdc++.h>
using namespace std;

int main()
{
    int count = 0;
    for (int i = 1; i <= 2020; i++)
    {
        string s = to_string(i);
        count += std::count(s.begin(), s.end(), '2');
    }
    cout << "数字2在1到2020中出现的次数是: " << count << endl;
    return 0;
}